<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../css/base.css">
    <link rel="stylesheet" href="css/fenLei.css" />
    <script src="../js/jquery-2.2.3.min.js"></script>
    <script src="../js/common.js"></script>
    <script src="../js/rem.js"></script>
    <style>
        .classfily {
            width: 100%;
            height: 100%;
            /* border: 1px solid red; */
            padding-top: 0.4rem;
            background: #fff;
        }

        .header {
            width: 100%;
            height: 0.4rem;
            text-align: center;
            line-height: 0.4rem;
            font-size: 0.16rem;
            position: fixed;
            top: 0;
            color: #000;
            padding: 0.1px;
        }

        .header a img {
            height: 50%;
            float: left;
            /* margin-top: 0.1rem;
			margin-left: 0.1rem; */
        }

        .classify-left {
            width: 25%;
            height: 100%;
            /* border: 1px solid black; */
            float: left;
            background: #f5f5f5;
        }

        .classify-right {
            width: 75%;
            height: 100%;
            /* border: 1px solid yellow; */
            float: right;
        }

        .classify-ul {
            width: 100%;
            height: 100%;
            overflow-y: auto;
        }

        .classify-ul li {
            width: 100%;
            height: 0.4rem;
            /* border: 1px solid blue; */
            float: left;
        }

        .fenlei_left_li:nth-child(1) {
            color: #EB4748;
            /* border-left: 1px solid #EB4748; */
            background: #FFFFFF;
        }

        .fenlei_left_li {
            width: 100%;
            height: 0.45rem;
            line-height: 0.45rem;
            font-size: 0.14rem;
            color: #666666;
            text-align: center;
        }

        .felei_right_li {
            width: 90%;
            height: 1rem;
            margin: 0 auto;
            border-bottom: 1px solid #ccc;
        }

        .felei_right_li {
            float: left;
            margin-bottom: 0.12rem;
            margin-right: 0.2rem;
        }

        .felei_right_li a {
            display: block;
            width: 100%;
            height: 100%;
        }

        .felei_right_li a img {
            float: left;
        }

        .felei_right_li a p {
            float: left;
            margin-left: 0.2rem;
            margin-top: 0.1rem;
        }
    </style>
</head>

<body>
    <div class="header">
        <a href="javascript:history.back(-1)"><img class="left" src="../img/g_next.png" alt="" /></a>
        分类
    </div>
    <div class="classfily">
        <div class="classify-left">
            <ul class="classify-ul">

            </ul>
        </div>
        <div class="classify-right">
            <p class="title" style="text-align: center; color:#ccc; line-height: 0.5rem;">——商家分类——</p>
            <ul class="felei_right_ul">

            </ul>
        </div>
    </div>
</body>
<script>
    $.ajax({
        url: SURL + '/jfd/shopIndustry/list',
        type: 'post',
        // contentType:'applaction/json',
        dataType: 'json',
        success: res => {
            console.log(res)
            res.forEach(element => {
                $('.classify-ul').append(
                    `
                    <li class="fenlei_left_li" onclick="classify(this)" data-id="${element.hyId}">
                    	${element.hyName}
                    </li>

					`
                )
            });
        }
    })

    function classify(e) {
        $(e).css({
            "backgroundColor":"#ffffff",
            "borderLeft":"1px solid #EB4748",
            "color":"#EB4748"
        })
        $(e).siblings().css({
            "backgroundColor":"#f5f5f5",
            "borderLeft":"none",
            "color":"#666666"
        })
        $('.felei_right_ul').html('');
        var hyid = $(e).attr('data-id')
        $.ajax({
            url: SURL + '/jfd/shops/yhIdSelectShjopslist',
            type: 'post',
            dataType: 'json',
            data: {
                industry: hyid
            },
            success: res => {
                console.log(res)
                res.forEach(element => {
                    $('.felei_right_ul').append(
                        `
                        <li class="felei_right_li">
                            <a href="../tmp/shopdetails.html?goodsType=3&id=${element.shopId}">
                                <img src="${element.logo}" alt="">
                                <p>${element.shopName}</p>
                            </a>
                        </li>
                    	`
                    )
                });
            }
        })
    }
</script>

</html>
